/**
 * 微信小程序requestAnimationFrame兼容实现
 */

const requestAnimationFrame = (callback) => {
  return wx.createSelectorQuery()
    .selectViewport()
    .boundingClientRect()
    .exec(() => {
      setTimeout(callback, 16)
    })
}

const cancelAnimationFrame = (id) => {
  clearTimeout(id)
}

export {
  requestAnimationFrame,
  cancelAnimationFrame
}
